package com.ttg.web.dao.original.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.model.mapper.original.BankCardDataInfoOriginalMapper;
import com.ttg.model.pojo.original.BankCardDataInfoOriginal;
import com.ttg.web.dao.original.BankCardDataInfoOriginalDao;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhangHongYuan
 * @description
 * @date 2024/4/16 16:44
 */
@Service
public class BankCardDataInfoOriginalDaoImpl extends ServiceImpl<BankCardDataInfoOriginalMapper, BankCardDataInfoOriginal> implements BankCardDataInfoOriginalDao {


    @Override
    public void truncate() {
        baseMapper.truncate();
    }

    @Override
    public Map<String, Long> existsMapByBankCards(List<String> existsWhere) {
        LambdaQueryWrapper<BankCardDataInfoOriginal> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.in(BankCardDataInfoOriginal::getBankCardNumber, existsWhere);
        Map<String, Long> rsMap = new HashMap<>();
        for (BankCardDataInfoOriginal bankCardDataInfoOriginal : list(lambdaQueryWrapper)) {
            rsMap.put(bankCardDataInfoOriginal.getBankCardNumber(), bankCardDataInfoOriginal.getId());
        }
        return rsMap;
    }
}
